Test Series - java script

Test Number 74/92

Q: How many properties are available in a memory object?
A. 1
B. 2
C. 3
D. 4
Solution: Advanced JavaScript application features such as caches and undo buffers need to know the memory consumption of objects in order to function effectively. There are a total of 3 memory objects namely:
jsHeapSizeLimit
totalJsHeapSize
usedJsHeapSize.
Q: What is a heap in JavaScript?
A. Collection of Java objects
B. Collection of JavaScript objects
C. Collection of memory usage values
D. Collection of data stored in memory
Solution: A heap is a tree-like data structure where each node must be ordered with respect to the value of its children. The heap is the collection of JavaScript objects that the interpreter keeps in resident memory.
Q: What is the function of the memory object?
A. Gets unused memory details
B. Shows optimization
C. Gets memory usage
D. Memory optimization
Solution: The JavaScript Memory column represents the JS heap. This column contains two values. The value you’re interested in is the live number (the number in parentheses). The memory object is a feature of Chrome that allows us to see the memory usage that Chrome is taking up while running our page.
Q: What is the command to access the Heap size limit?
A. performance.memory. SizeLimit
B. performance.memory. jsHeapSizeLimit
C. jsHeapSizeLimit
D. performance.jsHeapSizeLimit
Solution: Memory contains an object created with MemoryInfo constructor, containing jsHeapSizeLimit, totalJSHeapSize and usedJSHeapSize properties with numerical values. The command performance.memory. jsHeapSizeLimit is used to access the Heap size limit.
Q: What is the purpose of garbage collection?
A. Removes object with many reference
B. Removes object with reference
C. Removes object with invalid reference
D. Removes object with no reference
Solution: When the interpreter sees an object in the heap with no object references, it removes that object from the heap. This is called garbage collection. An object is considered garbage collectible if there are zero references pointing at this object.
Q: What does the usedJsHeapSize property indicate?
A. Amount of memory used
B. Amount of memory unused
C. Amount of memory used & unused
D. Amount of memory required
Solution: usedJsHeapSize returns an object of type ObjectObject. An object created with MemoryInfo constructor, containing jsHeapSizeLimit, totalJSHeapSize and usedJSHeapSize properties with numerical values. The usedJsHeapSize property is the amount of memory that all of the current objects in the heap are using.
Q: Which of the following property indicate the total size of the heap?
A. heapSize
B. totalHeapSize
C. totalJsHeapSize
D. totalHeap
Solution: usedJsHeapSize stores an object created with MemoryInfo constructor, containing jsHeapSizeLimit, totalJSHeapSize and usedJSHeapSize properties with numerical values.
Q: What can be done to monitor the memory usage?
A. Profiling
B. Sequencing
C. Serializing
D. Serializing & Sequencing
Solution: Garbage collected languages help developers manage memory by periodically checking which previously allocated pieces of memory can still be “reached” from other parts of the application. Profiling allows us to monitor our memory usage.
Q: Which of the following gives the high level breakdown of memory usage?
A. about:memory
B. memory
C. about-memory
D. about::memory
Solution: The Memory column represents native memory. DOM nodes are stored in native memory. If this value is increasing, DOM nodes are getting created. Typing about:memory into the location bar brings up a page that gives a high-level breakdown of memory usage.
Q: Which keyword must be used to get a more granular insight into the memory usage?
A. verb
B. verbose
C. granule
D. gran
Solution: Memory column represents native memory. To get a more granular insight into the memory usage, we must type about:memory?verbose.

You Have Score    /10